<template>
	<view class="item">
		<!-- 商品左侧图片区域 -->
		<view class="left">
			<image class="pic" :src="item.goods_big_logo||defaultPic"></image>
		</view>
		<!-- 商品右侧信息区域 -->
		<view class="right">
			<view class="name">{{item.goods_name}}</view>
			<view class="info">
				<view class="price">￥{{item.goods_price|tofixed}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "my-goods",
		props: {
			item: {
				type: Object,
				defaul: {},
			}
		},
		data() {
			return {
				defaultPic: 'https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png'
			};
		},
		filters:{
			// 把数字处理为带两位小数点的数字
			tofixed(num){
				return Number(num).toFixed(2)
			}
		}
	}
</script>

<style lang="less">
	.item {
		display: flex;
		padding: 10px 5px;
		border-bottom: 1px solid #f0f0f0;

		.left {
			margin-right: 5px;

			.pic {
				width: 100px;
				height: 100px;
				display: block;
			}
		}

		.right {
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.name {
				font-size: 13px;
			}

			.price {
				font-size: 16px;
				color: #c00000;
			}
		}
	}
</style>
